Path: blob/master/Part 4 - Clustering/Hierarchical Clustering/[Python] Hierarchical Clustering.ipynb
1009 views
Kernel: Python 3
Hierarchical Clustering
Data Preprocessing
In [1]:
In [2]:
In [3]:
Out[3]:
array([[15, 39],
[15, 81],
[16, 6],
[16, 77],
[17, 40],
[17, 76],
[18, 6],
[18, 94],
[19, 3],
[19, 72]])
Using the dendrogram to find the optimal number of clusters
In [4]:
Out[4]:
Text(0,0.5,'Euclidean Distance')
From the above dendrogram we can see that the maximum length verticle line whcih does not have any horizontal line is the one providing the number of clusters as 5.
Fitting Hierarchical Clustering to the dataset
In [5]:
Visualising the clusters
In [6]:
Out[6]:
The target customers should be the one with High Income and High Spend.